package com.king.mapper;

import com.king.pojo.dto.RoleDTO;
import com.king.pojo.entity.SysRole;
import com.king.pojo.vo.RoleQueryVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

@Mapper
public interface RoleMapper {

    @Mapping(source = "name", target = "roleName")
    SysRole roleDtoToRole(RoleDTO roleDto);

    List<RoleQueryVo> roleListToQueryVO(List<SysRole> roleList);

    @Mapping(source = "roleId", target = "id")
    @Mapping(source = "roleName", target = "name")
    @Mapping(target = "createTime", source = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Mapping(target = "updateTime", source = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
    RoleQueryVo roleToQueryVO(SysRole sysRole);
}
